package me.cloudcat.develop.dao.configuration;

import java.util.List;

import javax.persistence.QueryHint;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.QueryHints;

import me.cloudcat.develop.dao.base.BaseRepository;
import me.cloudcat.develop.entity.configuration.User;

public interface UserDao extends BaseRepository<User, Long>, JpaSpecificationExecutor<User> {

	@Query(value="select u from User u where username=?1 and pass=?2")
	public User findOne(String username,String pass);
	
	
	@Query(value="select u from User u where username=?")
	public User findOne(String username);
	
	
	@QueryHints(value={@QueryHint(name="org.hibernate.cacheable",value="true")})
	@Query(value="from User")
	public List<User> findAllUser();
	
}
